
function main() {
    var testVersion = "(201901021555)版";
    var softwareName = "抖音";
	var userData = RequestEngine.getUserData();
    var webData = RequestEngine.getWebView();
    var userJson = eval(userData);
    var webJson = JSON.parse(webData);
    var default_hs = webJson.view_hs;
    if ( default_hs == "话术为空" ) {
        default_hs = "";
    }

    AccessibilityEngine.log("开始主要逻辑20180808");
	AccessibilityEngine.sleepEngine(3000);
	if (AccessibilityEngine.checkUpId(widget.pages.shouye.exit) == ISTRUE) { //取消
        AccessibilityEngine.mockOnClickId(widget.pages.shouye.exit);
    }
	AccessibilityEngine.sleepEngine(2000);//等待
	if (AccessibilityEngine.checkUpId(widget.pages.shouye.wzdl) == ISTRUE) { //我知道了
        AccessibilityEngine.mockOnClickId(widget.pages.shouye.wzdl);
    }
    if (AccessibilityEngine.checkUpId(widget.pages.shouye.bugengxin) == ISTRUE) {//更新以后再说
        AccessibilityEngine.mockOnClickId(widget.pages.shouye.bugengxin);
    }
	var jixing = getXYByIdIndex(widget.pages.shouye.wode);
	AccessibilityEngine.mockOnClickId(widget.pages.shouye.shousuo); // 点击搜索 放大镜
	if (AccessibilityEngine.checkUpId(widget.pages.shouye.bugengxin) == ISTRUE) {//更新以后再说
        AccessibilityEngine.mockOnClickId(widget.pages.shouye.bugengxin);
    }
   
	AccessibilityEngine.sleepEngine(1000);//等待
	
	for (var i = 0; i < userJson.length; i++) {
		if (AccessibilityEngine.checkUpId(widget.pages.shouye.bugengxin) == ISTRUE) {//更新以后再说
			AccessibilityEngine.mockOnClickId(widget.pages.shouye.bugengxin);
		}
    	var mobile = "";
    	if (userJson[i].unicode != "" && userJson[i].unicode != undefined) {
    		mobile = userJson[i].unicode;
    	}
    	var reg = new RegExp("[\\u4E00-\\u9FFF]+","g");
        if(reg.test(mobile)){
            continue;
        }
    	if (mobile == "") {
    		continue;
    	}
		var hs = userJson[i].hs1;
    	if (hs == undefined || hs == "") {
    		hs = default_hs;
    	}
		 if( jixing == 1 ){
			ScreenEngine.swipe(parseX(300), parseY(100), parseX(300), parseY(100), 500); //点击
		} else if( jixing == 2 ){
			ScreenEngine.swipe(parseX(300), parseY(95), parseX(667), parseY(95), 500); //点击
		}
		AccessibilityEngine.sleepEngine(3000);//等待AccessibilityEngine.sleepEngine(1000);//等待
		if (AccessibilityEngine.checkUpId(widget.pages.shouye.bugengxin) == ISTRUE) {//更新以后再说
			AccessibilityEngine.mockOnClickId(widget.pages.shouye.bugengxin);
		}
		AccessibilityEngine.sleepEngine(3000);//等待AccessibilityEngine.sleepEngine(1000);//等待
		AccessibilityEngine.mockEditId(widget.pages.shouye.shousuopinglunKuang,mobile); //赋值搜索框
		if (AccessibilityEngine.checkUpId(widget.pages.shouye.bugengxin) == ISTRUE) {//更新以后再说
			AccessibilityEngine.mockOnClickId(widget.pages.shouye.bugengxin);
		}
	
		  AccessibilityEngine.sleepEngine(2000);//等待
		//搜索按钮
		if (jixing == 1) {
			ScreenEngine.swipe(parseX(665), parseY(1219), parseX(665), parseY(1219), 500); //点击
		} else if (jixing == 2) {
			AccessibilityEngine.sleepEngine(5000);//等待
			//ScreenEngine.swipe(parseX(480), parseY(715), parseX(480), parseY(715), 500); //点击	
			ScreenEngine.swipe(parseX(700), parseY(1200), parseX(700), parseY(1200), 500); //点击
		}
		if (AccessibilityEngine.checkUpIdText("android:id/text1","用户")== ISTRUE) {
				AccessibilityEngine.mockOnClickIdText("android:id/text1","用户") //  //点击搜索框后出现的搜索按钮后出现的页面的用户
		}
		AccessibilityEngine.sleepEngine(1000);//等待
		
		if(AccessibilityEngine.checkUpText("搜索结果为空") == ISTRUE){
			AccessibilityEngine.mockBack();
			continue;
		}
		if (AccessibilityEngine.checkUpIdText("android:id/text1","用户")== ISTRUE) {
            AccessibilityEngine.mockOnClickIdText("android:id/text1","用户") //  //点击搜索框后出现的搜索按钮后出现的页面的用户
		}
		AccessibilityEngine.sleepEngine(1000);//等待
		if (AccessibilityEngine.checkUpId(widget.pages.shouye.bugengxin) == ISTRUE) {//更新以后再说
			AccessibilityEngine.mockOnClickId(widget.pages.shouye.bugengxin);
		}
		AccessibilityEngine.sleepEngine(3000);//等待AccessibilityEngine.sleepEngine(1000);//等待
		if (AccessibilityEngine.checkUpId(widget.pages.shousuoyemian.touxiang) == ISTRUE) { //点击第一个头像
			AccessibilityEngine.mockOnClickId(widget.pages.shousuoyemian.touxiang);
		}
		AccessibilityEngine.sleepEngine(1000);//等待
		if (AccessibilityEngine.checkUpId(widget.pages.shousuoyemian.fensiguanzu) == ISTRUE) { //关注
			AccessibilityEngine.mockOnClickId(widget.pages.shousuoyemian.fensiguanzu);
		}
		
		AccessibilityEngine.sleepEngine(3000);//等待
		if (AccessibilityEngine.checkUpText("对方已设置为私密帐号，需要对方通过请求后才能成功关注哦～") == ISTRUE  || AccessibilityEngine.checkUpIdText("android:id/message", "对方已设置为私密帐号，需要对方通过请求后才能成功关注哦～") == ISTRUE  || AccessibilityEngine.checkUpId("android:id/message") == ISTRUE ) { //私密账号 
			AccessibilityEngine.sleepEngine(2000);
			AccessibilityEngine.mockBack();
			AccessibilityEngine.sleepEngine(2000);
			AccessibilityEngine.mockBack();
			AccessibilityEngine.sleepEngine(2000);
			continue;
		}
		
		AccessibilityEngine.sleepEngine(3000);//等待  //已请求...
		if (AccessibilityEngine.checkUpText("已请求") == ISTRUE  || AccessibilityEngine.checkUpIdText("com.ss.android.ugc.aweme:id/c9g", "已请求") == ISTRUE  || AccessibilityEngine.checkUpId("com.ss.android.ugc.aweme:id/c9g") == ISTRUE ) { //私密账号 
			AccessibilityEngine.sleepEngine(2000);
			AccessibilityEngine.mockBack();
			AccessibilityEngine.sleepEngine(2000);
			AccessibilityEngine.mockBack();
			AccessibilityEngine.sleepEngine(2000);
			continue;
		}
		if (AccessibilityEngine.checkUpId(widget.pages.shousuoyemian.faxiaoxianniu) == ISTRUE) { //发消息按钮
			AccessibilityEngine.mockOnClickId(widget.pages.shousuoyemian.faxiaoxianniu);
		}
		AccessibilityEngine.sleepEngine(1000);//等待
		
		if (AccessibilityEngine.checkUpId(widget.pages.shouye.bugengxin) == ISTRUE) {//更新以后再说
			AccessibilityEngine.mockOnClickId(widget.pages.shouye.bugengxin);
		}
		AccessibilityEngine.sleepEngine(3000);//等待AccessibilityEngine.sleepEngine(1000);//等待
		
		AccessibilityEngine.mockEditId(widget.pages.fasongxiaoxi.fasongxiaoxikuang, hs); //消息框赋值
		AccessibilityEngine.mockOnClickId(widget.pages.fasongxiaoxi.fasonganniu); // 发送
		AccessibilityEngine.sleepEngine(1000);//等待
		AccessibilityEngine.mockBack();
		AccessibilityEngine.sleepEngine(1000);//等待
		AccessibilityEngine.mockBack();
		AccessibilityEngine.sleepEngine(1000);//等待
		AccessibilityEngine.mockBack();
	}
	setTaskState("5", "执行成功");
    throw SyntaxError();
}

var publicfunction = RequestEngine.getPluginPath() + "OS_DYCOMMON/publicfunction.js";
include(publicfunction); //公共方法js
var widgetPath = dyConditionCheck();
var widgetbyid = RequestEngine.getPluginPath() +"OS_DYCOMMON/"+ widgetPath;
include(widgetbyid);
main();